package de.haw.shc.JSONObjects;

import android.util.Log;
import de.haw.shc.Interfaces.iSzene;
import de.haw.shc.Action.Actions;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: mizus
 * Date: 11.07.13
 * Time: 12:57
 * To change this template use File | Settings | File Templates.
 */
public class Szene implements iSzene {

    private String action = Actions.LIGHTCONTROL;
    private String name;

    public Szene(String szene){
        name = szene;
    }

    @Override
    public JSONObject startSzene() {
        Map<String, Object> valMap = createValueMap("start_szene_"+name);
        JSONObject jsonObj = new JSONObject(valMap);
        Log.d("iLight.createOn", jsonObj.toString());
        return jsonObj;
    }

     @Override
    public JSONObject stopSzene() {
         Map<String, Object> valMap = createValueMap("stop_szene_"+name);
         JSONObject jsonObj = new JSONObject(valMap);
         Log.d("iLight.createOn", jsonObj.toString());
         return jsonObj;
     }

    @Override
    public JSONObject resumSzene() {
        Map<String, Object> valMap = createValueMap("resume_szene_"+name);
        JSONObject jsonObj = new JSONObject(valMap);
        Log.d("iLight.createOn", jsonObj.toString());
        return jsonObj;
    }

    private Map<String, Object> createValueMap(String name){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("Id", "StephanTimo");
        result.put("Version", null);
        result.put("action",  name);
        return result;
    }

    @Override
    public String getDeviceControll() {
        return action;  //To change body of implemented methods use File | Settings | File Templates.
    }

}
